package com.ecloud.hbase.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author Squbi
 */
@Configuration
@EnableConfigurationProperties
public class HbaseConfig {
    @Value("${hbase.zookeeper.quorum}")
    private String zkHosts;
    @Value("${hbase.zookeeper.property.clientPort}")
    private String zkPort;
    @Value("${zookeeper.znode.parent}")
    private String parent;

    @Bean
    public org.apache.hadoop.conf.Configuration config() {
        org.apache.hadoop.conf.Configuration config = new org.apache.hadoop.conf.Configuration();
        config.set("hbase.zookeeper.quorum", zkHosts);
        config.set("hbase.zookeeper.property.clientPort", zkPort);
        config.set("zookeeper.znode.parent", parent);
        return config;
    }
}